//
//  StudentView.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/19.
//

#import "StudentView.h"

@implementation StudentView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self CreateUI];
    }
    return self;
}

-(void)CreateUI{
    
    UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, 120)];
    backview.backgroundColor = [UIColor whiteColor];
    [self addSubview:backview];

    
    //学员
    UIView *studentLine = [[UIView alloc]initWithFrame:CGRectMake(15, 15, 3, 15)];
    studentLine.backgroundColor = rgba(22, 120, 255, 1);
    studentLine.layer.cornerRadius = 2;
    [backview addSubview:studentLine];
    UILabel *studentLab = [[UILabel alloc]initWithFrame:CGRectMake(studentLine.frame.size.width+studentLine.frame.origin.x+5, 15, 70, 15)];
    studentLab.text = @"学员";
    studentLab.textColor = [UIColor blackColor];
    studentLab.textAlignment = 0;
    studentLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backview addSubview:studentLab];
    
    NSArray *StudentArr = @[@"student",@"dianping",@"anpai",@"chengji"];
    NSArray *myStudentLabArrs = @[@"我的学员",@"学员点评",@"考试安排",@"模拟成绩"];
    
    
    for (int i = 0; i < StudentArr.count; i++) {
        UIButton *studentBtn = [[UIButton alloc]initWithFrame: CGRectMake(i*(APPwidth/4), studentLab.height+studentLab.y+10, APPwidth/4, 60)];
        studentBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        studentBtn.titleLabel.textAlignment = 1;
        [studentBtn setTitleColor:rgba(51, 51, 51, 1) forState:0];
        [studentBtn setImage:[UIImage imageNamed:StudentArr[i]] forState:0];
        [studentBtn setTitle:myStudentLabArrs[i] forState:0];
        studentBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 25, 15, 25);
        [studentBtn.imageView setContentMode:UIViewContentModeScaleAspectFit];
        studentBtn.titleEdgeInsets = UIEdgeInsetsMake(60, -45, 0, 0);
        [backview addSubview:studentBtn];
        
        if (i == 0) {
            _myStudentBtn = studentBtn;
        }else if(i == 1){
            _dianpingBtn = studentBtn;
        }else if (i == 2){
            _anpaiBtn = studentBtn;
        }else{
            _chengjiBtn = studentBtn;
        }
//        
    }
 
    
}




@end
